<template>
  <div class="container">
    <div class="screen" ref="screen">
      <div class="top">
        <Top></Top>
      </div>
      <div class="body">
        <div class="left">
          <Tourist class="tourist"></Tourist>
          <Sex class="sex"></Sex>
          <Age class="age"></Age>
        </div>
        <div class="center">
          <Map class="map"></Map>
          <Line class="line"></Line>
        </div>
        <div class="right">
          <Spot class="spot"></Spot>
          <AnnualVisitor class="annualVisitor"></AnnualVisitor>
          <Data class="data"></Data>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";
import Top from "./components/top/index.vue";
import Sex from "./components/sex/index.vue";
import Tourist from "./components/tourist/index.vue";
import Age from "./components/age/index.vue";
import Map from "./components/map/index.vue";
import Line from "./components/line/index.vue";
import Spot from "./components/spot/index.vue";
import AnnualVisitor from "./components/annualVisitor/index.vue";
import Data from "./components/data/index.vue";
const screen = ref();
onMounted(() => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%, -50%)`;
});
function getScale(w = 1920, h = 1080) {
  const ww = window.innerWidth / w;
  const wh = window.innerHeight / h;
  return ww < wh ? ww : wh;
}
window.onresize = () => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%, -50%)`;
};
</script>

<style lang="scss" scoped>
.container {
  width: 100vw;
  height: 100vh;
  background: url(./images/bg.png) no-repeat;
  background-size: cover;
  .top {
    width: 100%;
    height: 40px;
    // background: cadetblue;
  }
  .body {
    display: flex;
    .left {
      flex: 1;
      height: 1030px;
      display: flex;
      flex-direction: column;
      .tourist {
        flex: 1.1;
      }
      .sex {
        flex: 1;
      }
      .age {
        flex: 1;
      }
    }
    .center {
      flex: 2;
      display: flex;
      flex-direction: column;
      .map {
        flex: 3.2;
      }
      .line {
        flex: 1;
      }
    }
    .right {
      flex: 1;
      display: flex;
      flex-direction: column;
      .spot {
        flex: 1.1;
      }
      .annualVisitor {
        flex: 1;
      }
      .data {
        flex: 1;
      }
    }
  }
}
.screen {
  position: fixed;
  width: 1920px;
  height: 1080px;
  // background: red;
  top: 50%;
  left: 50%;
  transform-origin: left top;
}
</style>
